<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery/jquery.min.js"></script>
    <script src="js/common.js"></script>
    <script src="js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
    <script src="js/plugins/jquery-form/jquery.form.js"></script>
    <link rel="stylesheet" href="js/plugins/dialog2/dialog.css">
    <script src="js/plugins/dialog2/dialog.min.js"></script>
    <link rel="stylesheet" href="js/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/myProfiles.css"/>
    <script src="js/bootstrap/js/bootstrap.min.js"></script>
    <script src="js/plugins/messager/jquery.bootstrap.min.js"></script>
    <!------------------------------------------------------------------>
    <script>
        $(function () {
            //接收在共享与里的user
            var userJsonStr = sessionStorage.getItem("user");
            var user;
            if (userJsonStr) {
                //把字符串解析为json对象
                user = JSON.parse(userJsonStr);
            }
            //获取到传递过来的数据
            var href;
            var params = getParams();
            $.get("/products/" + params.id + "/detail", function (data) {
                $(".body_bg").renderValues({list: data}, {
                    setPayId: function (items, value) {
                        href = $(items).data("href") + "/" + user.id + "/" + value + "/save?state=1&payId=1";
                        // $(items).attr("href",href);
                    }
                });
            })


            /*加载购物车绑定个点击事件*/
                $("#save").click(function () {
                    if(user){
                        $.ajax({
                            url: "/products/" + user.id + "/" + params.id + "/save",
                            type: "PUT",
                            success: function (data) {
                                if (data.success) {
                                    window.location.href = "/mine/shopping_cart.html";
                                }
                            }
                        })
                    }else{
                        $.messager.alert("温馨提示!","请登录后再操作!")
                        window.location.href="/login.html"
                    }
                })
        })
    </script>
</head>
<body>
<div class="body_bg navbar navbar-fixed-top navbar-inverse">
    <dl class="dl-hor index3">
        <div class="content" render-html="list.content">
            <dt>价格表：</dt>
        </div>
    </dl>
    <table class="table table-striped" style="background-color: #00bbd3">
        <tr>
            <th>产品名称</th>
            <th>门市价</th>
            <th>骡窝窝价</th>
            <th>会员价</th>
            <th width="260px">操作</th>
        </tr>
        <tbody>
        <tr>
            <td render-html="list.name"></td>
            <td render-html="list.price"></td>
            <td render-html="list.loo_price"></td>
            <td render-html="list.vip_price"></td>
            <td>
                <a role="button" id="save" href="javascript:;">
                    <b><i class="fa fa-shopping-cart fa-2x " style="color: aqua;"></i></b><span>加入购物车</span></a></td>
        </tr>
        </tbody>
    </table>
    <dl class="dl-hor">
        <dt>景点地址：</dt>
        <dd>
            <p class="linetext" title="山东省淄博市周村区新建中路1号" render-html="list.placeDetail"></p>
        </dd>
    </dl>
    <dl class="dl-hor index3">
        <dt>营业时间：</dt>
        <dd>
            <p>
                8：00-17：30
            </p>
        </dd>
    </dl>
</div>
</body>
</html>